//
// Created by 紫霄 on 2020/3/30.
//

#include "BinTreeDemo.h"
#include <iostream>
//#include <opencl-c.h>

template <typename T> int BinTree<T>::updateNodeHeight(BinNodePos(T) x) {
  return x->height = 1 + ((nodeHeight(x->Lchild) > nodeHeight(x->Rchild))
                              ? nodeHeight(x->Lchild)
                              : nodeHeight(x->Rchild));
}
template <typename T> void BinTree<T>::updateNodeHeightAbove(BinNodePos(T) x) {
  while (x) {
    updateNodeHight(x);
    x = x->Parent;
  }
}
template <typename T>

BinNodePos(T) BinTree<T>::insertAsL(T const &e, BinNodePos(T) x) {
  x->insertAsL(e);
  ++_size;
  return x->Lchild;
}
template <typename T>
BinNodePos(T) BinTree<T>::insertAsR(T const &e, BinNodePos(T) x) {
  x->insertAsR(e);
  ++_size;
  return x->Rchild;
}
